package com.feiyun.api;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.feiyun.common.PageParam;
import com.feiyun.model.dto.ResultVO;
import com.feiyun.model.entity.UploadRecordInfo;
import com.feiyun.model.entity.UploadUserInfo;
import com.feiyun.model.entity.User;
import com.feiyun.model.entity.UserFileRelation;
import com.feiyun.service.ITempUserService;
import netscape.javascript.JSObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import java.util.List;

import static com.feiyun.util.ResponseUtil.success;

/**
 * @ClassName TempUserController
 * @author: xingming
 * @Description:
 * @time 2023/04/03 14:56:39
 * @Version 1.0
 */

@Controller
@RequestMapping("tempUser")
public class TempUserController {

    @Resource
    private ITempUserService tempUserService;

    @PostMapping("select")
    public ResponseEntity<ResultVO<List<User>>> selectUploadUserInfo(@RequestBody PageParam<UserFileRelation> pageParam) {
        List<User> userInfo = tempUserService.selectUploadUserInfo(pageParam);
        return success(userInfo);
    }

    @PostMapping("update")
    public ResponseEntity<ResultVO<Void>> updateTempUserInfo(@RequestBody User user) {
        tempUserService.updateTempUserInfo(user);
        return success();
    }
}
